#ifndef SERIALPORTTESTWGT_H
#define SERIALPORTTESTWGT_H

#include <QWidget>
#include <QHash>

QT_BEGIN_NAMESPACE
namespace Ui { class SerialPortTestWgt; }
QT_END_NAMESPACE

class QSerialPort;
class SerialPortTestWgt : public QWidget
{
    Q_OBJECT

public:
    SerialPortTestWgt(QWidget *parent = nullptr);
    ~SerialPortTestWgt();

private:
    void read_ini_file();

    void setContrlVisible(bool bVisible);

private slots:
    void sltReadData();

    void sltWaitReplay();

    void sltTimeUpdate();

    void sltScanSerialPort();

    void on_resetBtn_clicked();

    void on_startBtn_clicked();

    void on_openSerialPort_clicked();

    void on_sendClearBtn_clicked();

    void on_recvClearBtn_clicked();

    void on_cbx_algorSelect_currentIndexChanged(const QString &name);

private:
    void shotTest();//截图保存，临时使用

private:
    bool m_isReplay;

    QSerialPort *m_port;

    QByteArray m_rcvbuff;

    QTimer *m_pScanTimer;

    QTimer *m_pReadTimer;

    QTimer *m_pWaitTimer;

    quint32 m_timeDuration;

    QHash<QString ,quint32> m_algorithmValue;

    QHash<quint32 ,QString> m_targetTypeValue;

    Ui::SerialPortTestWgt *ui;
};
#endif // SERIALPORTTESTWGT_H
